//
//  CollectionReusableView.m
//  Study1
//
//  Created by Zeak on 2017/2/15.
//  Copyright © 2017年 Zeak. All rights reserved.
//

#import "CollectionReusableView.h"
#import "UIView+YZTCView.h"
#import "ImageLabelView.h"
#define SCREEN_WIDTH   [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT   [UIScreen mainScreen].bounds.size.height
#define SMALL_IMG_WIDTH ([UIScreen mainScreen].bounds.size.width-24) / 2
#define SMALL_IMG_HEIGHT 100
#define IMG_WIDTH 32.7

@interface CollectionReusableView(){
    UIImageView *_imgHeadView;
    UIView *_allView;
    UIImageView *_imgCenterView;
    UIImageView *_lefImgView;
    UIImageView *_rightImgView;
}

@end
@implementation CollectionReusableView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self scrollCreat];
        [self classifyViewCreat];
    }
    
    return self;
}

-(void)scrollCreat{
    
    _imgHeadView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 183)];
    _imgHeadView.image = [UIImage imageNamed:@"图层26"];
    [self addSubview:_imgHeadView];
}

-(void)classifyViewCreat{
    _allView = [[UIView alloc]initWithFrame:CGRectMake(0,_imgHeadView.yzBottom, SCREEN_WIDTH, 152 + 127)];
    //    allView.backgroundColor = [UIColor redColor];
    NSArray *imgNames = @[@"home_teacher_icon",@"图层13",@"图层12",@"图层31",@"图层10",@"图层31"];
    NSArray *labelNames = @[@"讲师",@"达人",@"课程",@"问答",@"圈子",@"活动"];
    for (int i = 0; i < 2; i ++) {
        for (int j = 0; j < 3; j ++) {
            int num = i * 3 + j;
            ImageLabelView *viewsss =  [[ImageLabelView alloc]initWithFrame:CGRectMake(44 + j * (66 + IMG_WIDTH), 16 + i * (IMG_WIDTH + 34), IMG_WIDTH, IMG_WIDTH + 16) imgName:imgNames[num] labelName:labelNames[num]];
            [_allView addSubview:viewsss];
        }
    }
    _imgCenterView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 152, SCREEN_WIDTH, 127)];
    _imgCenterView.image = [UIImage imageNamed:@"图层5"];
    [_allView addSubview:_imgCenterView];
    _lefImgView = [[UIImageView alloc]initWithFrame:CGRectMake(8, _allView.yzBottom + 10, SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT)];
    _lefImgView.image = [UIImage imageNamed:@"图层34"];
    _rightImgView = [[UIImageView alloc]initWithFrame:CGRectMake(_lefImgView.yzRight + 8 , _allView.yzBottom + 10, SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT)];
    _rightImgView.image = [UIImage imageNamed:@"图层34"];
    [self addSubview:_allView];
    [self addSubview:_lefImgView];
    [self addSubview:_rightImgView];
}
@end
